#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

const int mod = 1e9 + 7;
const int MX = 100010;

long long f[MX], g[MX];

int init = []() {
    f[0] = g[0] = 1;
    f[1] = g[1] = 1;
    f[2] = g[2] = 2;
    f[3] = g[3] = 4;
    for (int i = 4; i < MX; i++)
    {
        f[i] = (f[i - 1] + f[i - 2] + f[i - 3]) % mod;
        g[i] = (g[i - 1] + g[i - 2] + g[i - 3] + g[i - 4]) % mod;
    }
    return 0;
} ();

class Solution {
public:
    int countTexts(string s) {
        long long res = 1;
        int cnt = 0;
        for (int i = 0; i < s.size(); i++)
        {
            char c = s[i];
            cnt++;
            if (i == s.size() - 1 || c != s[i + 1])
            {
                res = res * (c != '7' && c != '9' ? f[cnt] : g[cnt]) % mod;
                cnt = 0;
            }
        }
        return res;
    }
};